
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
swagger-schema-official
Advanced tools
The swagger-schema-official npm package provides the official Swagger (OpenAPI) 2.0 schema definitions. It allows developers to validate and work with Swagger 2.0 specifications in their applications.
Schema Validation
This feature allows you to validate a Swagger 2.0 document against the official Swagger schema using a JSON schema validator like Ajv.
const swaggerSchema = require('swagger-schema-official');
const Ajv = require('ajv');
const ajv = new Ajv();
const validate = ajv.compile(swaggerSchema);
const swaggerDoc = { /* your Swagger 2.0 document */ };
const valid = validate(swaggerDoc);
if (!valid) console.log(validate.errors);
Schema Reference
This feature provides direct access to the Swagger 2.0 schema definitions, which can be used for various purposes such as validation, documentation, or tooling.
const swaggerSchema = require('swagger-schema-official');
console.log(swaggerSchema);
swagger-parser is a powerful library for parsing, validating, and dereferencing Swagger (OpenAPI) documents. It supports both Swagger 2.0 and OpenAPI 3.0, making it more versatile than swagger-schema-official, which is limited to Swagger 2.0.
openapi-schema-validator is a library for validating OpenAPI 3.0 schemas. While it does not support Swagger 2.0, it is useful for developers working with the newer OpenAPI 3.0 standard.
swagger-tools provides a suite of tools for working with Swagger 2.0 documents, including validation, routing, and middleware for Express.js. It offers more functionality than swagger-schema-official, which is focused solely on schema definitions.
This is only JSON Schema file for Swagger version 2.0. Download and Install it via NPM or Bower.
npm install --save swagger-schema-official
npm install --save swagger-schema-official@1.2.0
bower install --save swagger-schema
MIT
FAQs
Swagger JSON Schema
The npm package swagger-schema-official receives a total of 342,504 weekly downloads. As such, swagger-schema-official popularity was classified as popular.
We found that swagger-schema-official demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.